Repository navigation
Check a catalog when a supervision tree starts - #150
Merged
Merged
Conversation
The HTTP transport checks only that its catalog exports capabilities/0,
because Plug may run its initialisation at the host's compile time. A
catalog BeamMCP.Server.new/1 refuses was then answered 500 on every
request, while UPGRADING's 1.0.2 row said both transports refuse it at
startup.
BeamMCP.Catalog.child_spec/1 makes {BeamMCP.Catalog, catalog: M} a
child that calls validate/2 once and keeps no process. A catalog it
refuses fails the tree's start with {:invalid_catalog, catalog, reason},
before the children after it. The README and the transport's docs show
it before the server, and UPGRADING corrects the 1.0.2 row.
Signed-off-by: Ayla Croft <ayla@scriptkittyos.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
BeamMCP.Transport.HTTPchecks only that its catalog module exportscapabilities/0. It does not call it, because Plug may run the transport's initialisation at the host's compile time (underforwardor anyPlug.Builderpipeline). A catalog thatBeamMCP.Server.new/1refuses, such as a tool whosepatternECMA-262 does not read or two tools with one name, is then answered500/-32603on every request. UPGRADING's1.0.2row says both transports refuse such a catalog at startup. The stdio transport does; the HTTP transport did not.BeamMCP.Catalog.child_spec/1adds a startup check a host puts in its supervision tree:BeamMCP.Catalog.validate/2once and keeps no process: a temporary child that answers:ignore.{:invalid_catalog, catalog, reason}, before the children after it.:catalogand:pattern_dialect, and raisesArgumentErroron anything else when the spec is built.The transport's initialisation is unchanged. Checking there when not compiling would change startup for correct hosts whose catalog reads state that a later child creates.
Docs
1.1.0pattern row names the child; a note corrects the1.0.2row.docs/public-api.txt:child_spec/1is listed.Tests
test/beam_mcp/catalog_at_boot_test.exs:validate/2, and the next child never starts.pattern_dialect: :pcreadmits the atomic group.Checks
tools/gate.shpasses on this tree. The suite passes on Elixir 1.20 with OTP 29.